package initalize

import (
	"gorm.io/driver/mysql"
	"gorm.io/gorm"
	"gorm.io/gorm/schema"
	"project06_src/src/global"
)

func InitDb() {
	dns := "root:123456@(127.0.0.1:3306)/grpcproject?charset=utf8&parseTime=True&loc=Local"
	var err error
	global.Db, err = gorm.Open(mysql.Open(dns), &gorm.Config{
		NamingStrategy: schema.NamingStrategy{
			SingularTable: true,
		},
	})
	if err != nil {
		panic(err)
	}
}
